package aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Component
@Aspect
public class LogAspect {
	private final  String pointCut="execution(* collector.Collector.collect(..))"; 
	
	@Before(value=pointCut)
	public void logBefore() {
		System.out.println("log before...");
	}
	@After(value=pointCut)
	public void logAfter() {
		System.out.println("log after...");
	}
	@Around(value=pointCut)
	public Object logAround(ProceedingJoinPoint point){
		Object o=null;
		System.out.println("log before in around...");
		try {
		//	o=point.proceed();
		} catch (Throwable e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}//target method called!
		System.out.println("log after in around...");
		return o;
	}
}
